package com.htandroid.htandroid.global;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;

import com.ab.global.AbAppConfig;
import com.htandroid.htandroid.entity.Costobj;
import com.htandroid.htandroid.entity.Department;
import com.htandroid.htandroid.entity.Gcwx_Bxdj;
import com.htandroid.htandroid.entity.Gcwx_Person;
import com.htandroid.htandroid.entity.Gcwx_Places;
import com.htandroid.htandroid.entity.Gcwx_Printsend;
import com.htandroid.htandroid.entity.Inventory;
import com.htandroid.htandroid.entity.UffjOptions;
import com.htandroid.htandroid.entity.UserAuth;
import com.htandroid.htandroid.entity.Vendor;
import com.htandroid.reconstitute.utils.ToastUtil;

import java.util.ArrayList;

public class MyApplication extends Application {
    public SharedPreferences mSharedPreferences = null;

    private String registrationId;
    private String gs_ztid;
    private String gs_ztname;
    private String gs_sj;
    private String gs_year;
    private ArrayList<Inventory> gv_cinv;
    private ArrayList<Vendor> gv_vendor;
    private ArrayList<Gcwx_Printsend> gv_printsend;
    private ArrayList<Gcwx_Person> gv_gcwxperson;
    private ArrayList<Gcwx_Bxdj> gv_gcwxbxdj;
    private ArrayList<Department> gv_department;
    private ArrayList<Gcwx_Places> gv_gcwxplaces;
    private ArrayList<Costobj> gv_costobj;//成本对象
    private ArrayList<UserAuth> gv_userauth;//权限
    private UffjOptions gs_option1; //参数设置1
    private UffjOptions gs_option2; //参数设置2

    @Override
    public void onCreate() {
        super.onCreate();
        mSharedPreferences = getSharedPreferences(AbAppConfig.SHARED_PATH,
                Context.MODE_PRIVATE);
        ToastUtil.init(this);
    }

    public Boolean authfind(String auth_id) {
        if (gv_userauth == null) return false;
        Boolean haveauth = false;
        for (int i = 0; i < gv_userauth.size(); i++) {
            UserAuth auth = gv_userauth.get(i);
            //有权限则跳出
            if (auth.authfind(auth_id)) {
                haveauth = true;
                break;
            }
        }
        return haveauth;
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
    }

    public String getRegistrationId() {
        return registrationId;
    }

    public void setRegistrationId(String registrationId) {
        this.registrationId = registrationId;
    }

    public String getGs_ztid() {
        return gs_ztid;
    }

    public void setGs_ztid(String gs_ztid) {
        this.gs_ztid = gs_ztid;
    }

    public String getGs_ztname() {
        return gs_ztname;
    }

    public void setGs_ztname(String gs_ztname) {
        this.gs_ztname = gs_ztname;
    }

    public String getGs_sj() {
        return gs_sj;
    }

    public void setGs_sj(String gs_sj) {
        this.gs_sj = gs_sj;
    }

    public String getGs_year() {
        return gs_year;
    }

    public void setGs_year(String gs_year) {
        this.gs_year = gs_year;
    }

    public ArrayList<Vendor> getGv_vendor() {
        return gv_vendor;
    }

    public void setGv_vendor(ArrayList<Vendor> gv_vendor) {
        this.gv_vendor = gv_vendor;
    }

    public ArrayList<UserAuth> getGv_userauth() {
        return gv_userauth;
    }

    public void setGv_userauth(ArrayList<UserAuth> gv_userauth) {
        this.gv_userauth = gv_userauth;
    }

    public UffjOptions getGs_option1() {
        return gs_option1;
    }

    public void setGs_option1(UffjOptions gs_option1) {
        this.gs_option1 = gs_option1;
    }

    public UffjOptions getGs_option2() {
        return gs_option2;
    }

    public void setGs_option2(UffjOptions gs_option2) {
        this.gs_option2 = gs_option2;
    }

    public ArrayList<Gcwx_Person> getGv_gcwxperson() {
        return gv_gcwxperson;
    }

    public void setGv_gcwxperson(ArrayList<Gcwx_Person> gv_gcwxperson) {
        this.gv_gcwxperson = gv_gcwxperson;
    }

    public ArrayList<Gcwx_Bxdj> getGv_gcwxbxdj() {
        return gv_gcwxbxdj;
    }

    public void setGv_gcwxbxdj(ArrayList<Gcwx_Bxdj> gv_gcwxbxdj) {
        this.gv_gcwxbxdj = gv_gcwxbxdj;
    }

    public ArrayList<Department> getGv_department() {
        return gv_department;
    }

    public void setGv_department(ArrayList<Department> gv_department) {
        this.gv_department = gv_department;
    }

    public ArrayList<Gcwx_Places> getGv_gcwxplaces() {
        return gv_gcwxplaces;
    }

    public void setGv_gcwxplaces(ArrayList<Gcwx_Places> gv_gcwxplaces) {
        this.gv_gcwxplaces = gv_gcwxplaces;
    }

    public ArrayList<Gcwx_Printsend> getGv_printsend() {
        return gv_printsend;
    }

    public void setGv_printsend(ArrayList<Gcwx_Printsend> gv_printsend) {
        this.gv_printsend = gv_printsend;
    }

    public ArrayList<Inventory> getGv_cinv() {
        return gv_cinv;
    }

    public void setGv_cinv(ArrayList<Inventory> gv_cinv) {
        this.gv_cinv = gv_cinv;
    }

    public ArrayList<Costobj> getGv_costobj() {
        return gv_costobj;
    }

    public void setGv_costobj(ArrayList<Costobj> gv_costobj) {
        this.gv_costobj = gv_costobj;
    }

}
